<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="referrer" content="no-referrer" />
    <title>3DTiles模型</title>
    <style>
        body {
            position: absolute;
            margin: 0;
            width: 100%;
            height: 100%;
        }

        #mapContainer {
            left: 0px;
            top: 0px;
            width: 100%;
            height: 100%;
            float: left;
        }
    </style>
</head>

<body>

    <div id="mapContainer" style="position: relative;">
    </div>

</body>
<!-- <script src='http://localhost:9000/examples/GiswayEngine.js'></script> -->
<script src='/GiswayEngine.js'></script>
<script type="text/javascript">
    let cameraFov = 2; //相机视角
    window.app = new GE.App('mapContainer', {
        geographySystem: 'gcj02',
        //  //shape数据转3dtiles
        // position: [ 120.13056244701771, 30.268395468504576, 1000],
        // lookAt: [ 120.13056244701771, 30.268395468504576, 0],
        
        //上研院的测试数据
        // position: [ 112.66977,23.19397, 10000],
        // lookAt: [ 112.66977,23.19397, 0],

        //内蒙古的点云数据
        // position: [ 111.6214, 40.8580, 10000],
        // lookAt: [ 111.6214, 40.8580, 0],

        // 美国西海岸的点云数据
        // position: [ -123.071432532, 44.05931450, 10000],
        // lookAt: [ -123.071432532, 44.05931450, 0],

        //巴州
        // position: [84.21667, 41.46667, 2000],
        // lookAt: [84.21667, 41.46667, 0],

        // position: [86.009002,41.825716, 1000],
        // lookAt: [86.009002,41.825716, 200],
        

        // position: [118.13795895949274, 36.76828342762708, 1000],
        // lookAt: [118.13795895949274, 36.76828342762708, 0],
       
        // 兰溪
        // position: [119.32229022390463, 29.100791801021828, 3000],
        // lookAt: [119.32229022390463, 29.100791801021828, 0],

         // 老汪测试数据
        // position: [ 116.46988333595583, 39.91996994004822, 9000],
        // lookAt: [ 116.46988333595583, 39.9199699400482, 0],


        // 下姜村
        // position: [118.71870629387192, 29.377378045196107, 3500],
        // lookAt: [118.71870629387192, 29.377378045196107, 0],

        //测试有问题的数据
        // position: [101.8559230278732, 39.08308742609877, 15346.5684814277529],
        // lookAt: [101.8559230278732, 39.08308742609877, 0],

        //衡阳数据1
        // position: [112.61438290526809, 26.883927485255125, 15346.5684814277529],
        // lookAt: [112.61438290526809, 26.883927485255125, 0],

        // //rjy_osgb_output数据
        // position: [118.76769049871781, 31.828401267358743, 1000],
        // lookAt: [118.76769049871781, 31.828401267358743, 0],
        //  //银杏湖数据
        // position: [118.70548452198075, 31.807488124025067, 1000],
        // lookAt: [118.70548452198075, 31.807488124025067, 0],

         //彭州数据
        position: [103.76203086370245, 31.11462330140451, 1000],
        lookAt: [103.76203086370245, 31.11462330140451, 0],

         //高精细厂区模型数据
        // position: [120.26188632922555, 31.701460629476028, 1000],
        // lookAt: [120.26188632922555, 31.701460629476028, 0],

        //秣陵互通的数据
        // position: [118.81155644847766, 31.846654798784627, 10000],
        // lookAt: [118.81155644847766, 31.846654798784627, 0],
        
        //衡阳分块数据1
        // position: [112.63373595437776, 26.870605935077954, 10000],
        // lookAt: [112.63373595437776, 26.870605935077954, 0],

          //衡阳分块数据2
        // position: [112.620026998759, 26.8769870854122, 10000],
        // lookAt: [112.620026998759, 26.8769870854122, 0],
// 
        //方山社区模型
        // position: [118.87371002388403, 31.948222274141507, 1000],
        // lookAt: [118.87371002388403, 31.948222274141507, 0],

        //测试样例数据
        // position: [109.18370179577511, 34.4182321572946, 15346.5684814277529],
        // lookAt: [109.18370179577511, 34.4182321572946, 0],


        //烟台
        // position: [121.06480666564866, 37.68755563, 2000],
        // lookAt: [121.06480666564866, 37.68755563, 0],

        //辽东湾
        // position: [121.97978, 40.75601, 10000],
        // lookAt: [121.97978, 40.75601, 0],

        //建刚生产的测试数据
        // position: [121.97978, 40.75601, 200],
        // lookAt: [121.97978, 40.75601, 0],

        //position: [119.21816309392575, 34.670300493686966, 200],
        //lookAt: [119.21816309392575, 34.670300493686966, 0],

        //贵州
        // position: [108.0232, 26.4326, 2000],
        // lookAt: [108.0232, 26.4326, 0],

        //白洋淀
        // position: [115.97054690083002, 38.949655392764356, 2000],
        // lookAt: [115.97054690083002, 38.949655392764356, 0],

        //fbx转换到3dtiles的测试数据
        // position: [121.99824083179337, 40.71068467899703, 2000],
        // lookAt: [121.99824083179337, 40.71068467899703, 0],

        // position: [118.51031743575051, -0.0023777521580982193, 2000],
        // lookAt: [118.51031743575051, -0.0023777521580982193, 0],

        // fbx转到3dtiles的测试数据 //正在测试用的数据
        // position: [122.00151626214978, 40.71106690828059, 1000],
        // lookAt: [122.00151626214978, 40.71106690828059, 0],

        // position: [119.32229022390463, 29.100791801021828, 1000],
        // lookAt: [119.32229022390463, 29.100791801021828, 0],
        // position: [115.95616, 38.89975, 1500],s
        // lookAt: [115.95616, 38.89975, , 0],
        cameraScrollSpeed: 15,
        minZoom: 3,
        maxZoom: 23,
        cameraFov: cameraFov, //相机的fov
        verticalLevel: 6,
        maxSlopeAngle: 50,

        ambientLightIntensity: 2,
        ambientLightcolor: 0xffffff,//环境光照的颜色
        ambientLightType: 'ambient',//环境光照的类型，有如下类型:ambient，hemisphere
        supportLightType: 'single',//方向光的类型，有如下类型:single，double，tripple
        supportLightIntensity: 1,//方向光的强度
        supportLightcolor: '#ffffff', //方向光的颜色
        lightDistance: 2000,//方向光源距离初始相机target的距离
        lightHeight: 50,//方向光源的高度
        patchLoadCount: 5,
        useCarpet: true,
        background: "Fog",
        useDefaultTexture: false, //是否使用瓦片默认纹理
        baseLayer: [
            {
                // url: ' https://server.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
                 url: 'https://webst03.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
                // url:'https://gis5.ldwzh.com:28015/pj16/{z}/{x}/{y}.png',
                // url: 'https://tiles1.geovisearth.com/base/v1/img/{z}/{x}/{y}?format=webp&tmsids=w&token=3c7931ed450acfc9c8170efeead4759b146cfb78f0ee6908dd7e287270ee1b6f', //星空的影像地图url
                readableUrl: true,
                tileType: 'image',
                maxDataLevel: 17
            },
        ]
    });

    var threeTileModel;
    tiles3d();
    function tiles3d() {//examples\resources\3dtiles\Data\tileset.json
        threeTileModel = new GE.Tiles3d({
            //url: 'http://localhost:9000/examples/resources/3dtiles/nuotai/tileset.json',
            // url: 'http://localhost:9000/examples/resources/3dtiles/3Dtiles-3/tileset.json', refinement: 1, //loadRange: 100000,//白洋淀,
            // url: 'http://192.168.2.100:8702/resources/1b8b2fcb26b020120aebfac57779e06a/3dtiles/lanxi/3dtiles/tileset.json', refinement: 500, loadRange: 400, //兰溪
            // url: 'http://localhost:9000/examples/resources/3dtiles/总装/tileset.json', refinement: 1, loadRange: 400,  //老汪测试数据
            // url: 'http://192.168.2.44:9000/examples/resources/3dtiles/performanced_3dtiles/tileset.json', refinement: 100, loadRange: 400,
            // url: 'http://192.168.2.44:9000/examples/resources/3dtiles/performanced_old_3dtiles/tileset.json', refinement: 100, loadRange: 400,
            // url: 'http://localhost:9000/examples/resources/3dtiles/Huanglong3DTiles/tileset.json', //shape数据转3dtiles
            // url: 'http://localhost:9000/examples/resources/3dtiles/output/tileset.json', refinement: 10000, loadRange: 100,//内蒙古的点云数据
            // url: 'http://localhost:9000/examples/resources/3dtiles/2994small/tileset.json', refinement: 10000, loadRange: 100, //美国西海岸的点云数据
            // url: 'http://localhost:9000/examples/resources/3dtiles/jianzhu2/tileset.json', refinement: 10000, loadRange: 100,//上研院的测试数据
            // url: 'http://192.168.2.44:9000/examples/resources/3dtiles/BaZhou3DTiles/scenePart/tileset.json', refinement: 10000, loadRange: 300,
            // url: 'http://localhost:9000/examples/resources/3dtiles/bazhou_3dtiles_yuanshi/tileset.json', //shape数据转3dtiles
            // url: 'http://192.168.2.150:9999/webglres/resources/1b8b2fcb26b020120aebfac57779e06a/3dtiles/lanxi/3dtiles/tileset.json', refinement: 5, loadRange: 400, //兰溪
            // url: 'http://192.168.2.100:8702/resources/1b8b2fcb26b020120aebfac57779e06a/3dtiles/xiajiangcun/tileset.json', refinement: 10, loadRange: 300,//下姜村
            // url: 'http://localhost:9000/examples/resources/3dtiles/output0401/tileset.json', refinement: 100, loadRange: 100,//测试有问题的数据
            // url: 'http://localhost:9000/examples/resources/3dtiles/3dtiles_zip/output/newtileset.json', refinement: 70, loadRange: 0,//测试有问题的数据
            // url: 'https://gisdata.t-aaron.com/3dTiles/hengyang/xiangjiang/xiao03/xiao3/Data/tileset.json', refinement: 10, loadRange: 0,//衡阳数据1
            // url: 'http://localhost:9000/examples/resources/osgb/weinan/output/test.clt/tileset.json', //测试样例数据
            // url: 'http://localhost:9000/examples/resources/osgb/rjy_osgb_output/tileset.json', refinement: 100, loadRange: 0,//rjy_osgb_output数据
            // url: 'http://localhost:9009/examples/resources/osgb/高精细厂区模型_osgb/3dtiles/tileset.json', refinement: 100, loadRange: 0,//高精细厂区模型数据
            // url: 'http://localhost:9009/examples/resources/osgb/MoLingHuTong_OSGB/output/tileset.json', refinement: 300, loadRange: 0,//秣陵互通的数据
            // url: 'http://localhost:9009/examples/resources/osgb/衡阳分块/output_4/tileset.json', refinement: 300, loadRange: 0,//衡阳分块数据1
            // url: 'http://localhost:9009/examples/resources/osgb/衡阳分块/output_2/tileset.json', refinement: 150, loadRange: 0,//衡阳分块数据2
            // url: 'http://localhost:9009/examples/resources/osgb/rjy_osgb_output/tileset.json', refinement: 100, loadRange: 0,//rjy_osgb_output数据
            //  url: 'http://localhost:9009/examples/resources/osgb/银杏湖/tileset.json', refinement: 100, loadRange: 0,//银杏湖数据
            // url: 'https://bazhong.jouavcloud.com:6089/3dtiles/3dtiles0609/tileset.json', refinement: 100, loadRange: 0,//银杏湖数据
            url: 'http://localhost:9009/examples/resources/osgb/溧宁高速/output/tileset.json', refinement: 300, loadRange: 0,//溧宁高速
            // url: 'http://120.46.79.202/3dtiles/3dtiles-pzys/tileset.json', refinement: 100, loadRange: 0,//彭州数据
            // url: 'http://120.46.79.202/3dtiles/3ds/test2/tileset.json', refinement: 100, loadRange: 0,//彭州数据
            // url: 'https://bazhong.jouavcloud.com:6089/3dtiles/bahe3Dtiles/tileset.json', refinement: 1000, loadRange: 0,//巴中项目的数据
            // url: 'https://bazhong.jouavcloud.com:6089/3dtiles/3dtiles0617/tileset.json', refinement: 1000, loadRange: 0,//巴中项目的数据
            // url: 'https://gisdata.t-aaron.com/3dTiles/nanjing/rjy/rjy-3dtiles/tileset.json', refinement: 100, loadRange: 0,//rjy_osgb_output数据
            // url: 'http://localhost:9000/examples/resources/osgb/Lab-3dTiles/tileset.json', refinement: 100, loadRange: 0,//方山社区模型
            // url: 'http://192.168.2.150:9999/webglres/resources/1b8b2fcb26b020120aebfac57779e06a/3dtiles/guizhou/goodguizhou/tileset.json',refinement: 5, loadRange: 500,//贵州 还需要进一步测试
            // url: 'http://192.168.2.150:9999/webglres/resources/1b8b2fcb26b020120aebfac57779e06a/3dtiles/yantai/3DTiles/tileset.json', refinement: 50, loadRange: 800,//烟台
            // url: 'http://192.168.2.44:9000/examples/resources/3dtiles/CIP/PrimadOrigin3DTiles/L0_0/tileset.json', refinement: 50, loadRange: 0, //优化后的辽东湾数据
            // url:'http://192.168.2.44:9000/examples/resources/3dtiles/CIP/3dtiles/tileset.json', refinement: 500, loadRange: 0, //优化前的辽东湾数据
            // url: 'http://192.168.2.44:9000/examples/resources/3dtileszip/3dtiles/tileset.json', refinement: 1, loadRange: 100, //辽东湾
            // url: 'http://192.168.2.44:9000/examples/resources/3dtiles/CIP/3dtileszip/3dtiles/tileset.json', refinement: 1, loadRange: 10,//建刚生产的测试数据
            // url: 'http://192.168.2.43:8081/baiyangdian/3Dtiles/tileset.json', refinement: 1, loadRange: 1000, //白洋淀
            // url: 'http://localhost:9000/examples/resources/3dtiles/ZGX2/tileset.json', refinement: 1, loadRange: 1000,//fbx转换到3dtiles的测试数据
            //  url: 'http://localhost:9000/examples/resources/3dtiles/test/3dtiles/root.json', refinement: 1000.0, loadRange: 10,//fbx转换到3dtiles的测试数据
            // url: 'http://localhost:9000/examples/resources/3dtiles/Data/tileset.json', refinement: 40, loadRange: 100000,
            // url: 'http://localhost:9000/examples/resources/3dtiles/分离/5/tileset.json', refinement: 1, loadRange: 1000,//fbx转换到3dtiles的测试数据
            // autoLocate: true,
            isCloseGround: true,
            z: 5, //调整数据的高度， 用户可以根据数据做调整，一般情况下如果isCloseGround为true,可以不设置这个参数
            // minSize: 4000,
            // maxSize: 8000,

            // minSize: 1000,
            // maxSize: 5000,
             minSize: 500,
            maxSize: 3000,
            maxBytesSize: 0.3 * 2**10,
            minByteSize: 0.2 * 2**10,
            screenErrorFactor: 1.5, //屏幕误差缩放的倍数
            // screenErrorFactor: 8400, //屏幕误差缩放的倍数
            isOpenAdditionalCamera: false, //是否添加预加载的额外相机
            additionCameraFov: cameraFov * 2, //额外相机的fov
            unloadPercent: 1,
            maxJobs: 15,
            canNotSelect: false, //true表示该图层不参与射线拾取，false表示图层参与射线拾取
            // minSize: 160,
            // maxSize: 300,
            isSupportTransparent: false,
            isDoubleSide: false, //是否开启双面渲染
            //changeEmissive: true, //是否开启自发光
            //  geoSystem: '3857', //4978是椭球坐标系，3857是web墨卡托坐标系。这个参数可以不配置，默认是4978
            // isOnlyLoadCoarse: true, //是否只加载最粗略的瓦片
            dracoGltfPath: 'http://localhost:9009/examples/resources/plugin/draco/gltf/', //draco压缩的gltf文件解压后存放的路径
            isLocate: true,
        });
        app.add(threeTileModel);
        window.tiles3d = threeTileModel;
    }

    let model;
    function fbx() {
        model = new GE.OverLay({
            type: 'fbx',
            falldownSurface: threeTileModel, //模型要贴到的底图上，可以是3dtiles，也可以是其他的底图(比如dem)
            // url: 'http://localhost:9000/examples/resources/fbx/xqazm.fbx',
            // url: 'http://localhost:9000/examples/resources/fbx/ceshi1.FBX',
            // url: 'http://localhost:9000/examples/resources/fbx/ceshi1.FBX',
            url: 'http://localhost:9009/examples/resources/fbx/sxt.fbx',
            position: [101.8559230278732, 39.08308742609877, 60],
            changeEmissive: false,
            canNotSelect: true, //true表示该图层不参与射线拾取，false表示图层参与射线拾取
            scale: [0.5, 0.5, 0.5],
            // rotation: [45, 0, 0],
            success: function () {
                window.app.fireEvent('ThreeTileLoaded');

            }
        })
        model.renderOrder = 100;
        window.app.add(model);
    }
    // fbx();

    window.app.on('Click', function (e) {
        console.log(e);
    });

    window.app.on('ZoomChange', function (e) {
        // if (window.app.map.zoom > 17) {
        //     threeTileModel.isOnlyLoadCoarse = false;
        //     threeTileModel.screenErrorFactor = 1;
        // } else {
        //     threeTileModel.isOnlyLoadCoarse = true;
        //     threeTileModel.screenErrorFactor = 100;
        // }
    });

    // window.app.on('MapDragStart', function (e) {
    //     console.log('地图拖拽开始');
    // });
    // window.app.on('MapDragEnd', function (e) {
    //     console.log('地图拖拽结束');
    // });

</script>

</html>